package com.ssmdemo.pojo;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@TableName(value = "t_emp")
public class Emp {

    @TableId(type = IdType.AUTO)
    private Integer id;
    private Integer sex;
    @TableField(exist = false)
    private String sexStr;
    @TableField(value = "username")
    private String userName;
    @TableField(value = "password")
    private String passWord;
    private String email;
    private String mobile;
    @TableField(value = "department_id")
    private Integer departmentId;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birthday;
    @TableField(value = "create_time")
    private Date createTime;
    @TableField(exist = false)
    private User createUser;
    @TableField(exist = false)
    private User updateUser;
    @TableField(value = "update_time")
    private Date updateTime;
    @TableField(value = "user_png")
    private String userPng;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        if (sex == 1) {
            this.sexStr = "男";
        } else {
            if (sex == 0) {
                this.sexStr = "女";
            } else {
                this.sexStr = "人妖";
            }
        }

        this.sex = sex;

    }

    public String getSexStr() {
        return sexStr;
    }

    public void setSexStr(String sexStr) {
        if (sexStr == "男") {
            this.sex = 1;
        } else {
            if (sexStr == "女") {
                this.sex = 0;
            }
        }
        this.sexStr = sexStr;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public Integer getDepartmentId() {
        return departmentId;
    }

    public void setDepartmentId(Integer departmentId) {
        this.departmentId = departmentId;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public User getCreateUser() {
        return createUser;
    }

    public void setCreateUser(User createUser) {
        this.createUser = createUser;
    }

    public User getUpdateUser() {
        return updateUser;
    }

    public void setUpdateUser(User updateUser) {
        this.updateUser = updateUser;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getUserPng() {
        return userPng;
    }

    public void setUserPng(String userPng) {
        this.userPng = userPng;
    }

    @Override
    public String toString() {
        return "Emp{" +
                "id=" + id +
                ", sex=" + sex +
                ", sexStr='" + sexStr + '\'' +
                ", userName='" + userName + '\'' +
                ", passWord='" + passWord + '\'' +
                ", email='" + email + '\'' +
                ", mobile='" + mobile + '\'' +
                ", departmentId=" + departmentId +
                ", birthday=" + birthday +
                ", createTime=" + createTime +
                ", createUser=" + createUser +
                ", updateUser=" + updateUser +
                ", updateTime=" + updateTime +
                ", userPng='" + userPng + '\'' +
                '}';
    }
}
